﻿#include "datasimucache.h"

// 静态变量初始化
QMap<QString, QString> DataSimuCache::g_channelCacheMap;

DataSimuCache::DataSimuCache()
{
}

void DataSimuCache::initialize(const QStringList idList)
{
    for (int i = 0; i < idList.size(); i++)
        g_channelCacheMap.insert(idList.at(i), "");
}

bool DataSimuCache::contains(const QString &channel)
{
    return g_channelCacheMap.contains(channel);
}

QString DataSimuCache::getSimuValue(const QString &channel)
{
    if (g_channelCacheMap.contains(channel))
        return g_channelCacheMap.value(channel);

    return "";
}

void DataSimuCache::cacheSimuValue(const QString &channel, const QString value)
{
    if (g_channelCacheMap.contains(channel)) {
        g_channelCacheMap[channel] = value;
    }
}
